<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清浮动</title>
    <style>
        .box1,.box2{
            width: 200px;
            height: 200px;
            float: left;
        }
        .box1{
            background-color: yellow;
        }
        .box2{
            background-color: blue;
        }
        .box{
            width: 300px;
            height: 300px;
            background-color: red;
            /* clear: both; */
        }
        .container{
            /* height: 200px; */
            overflow:hidden ;
            /* bfc,让浮动元素计算高度 */
        }
        /* 解决高度塌陷方案：
        1.写固定高度
        2.清浮动 clear：none/ left.right,both
        3.当前浮动元素后面补一个盒子，不设置宽高，clear:both
        4.overflow:hidden
         */
    </style>
</head>
<body>
    <div class="container">
        <div class="box1"></div>
        <div class="box2"></div>
        <!-- <div style="clear: left;"></div> -->
    </div>
    <div class="box"></div>
</body>
</html>